my_word = 'hello world' print(my_word[-1]) # prints 'd' # - stands from last starting with index 1 print(my_word[-4:]) # prints 'orld' # if you know the length you can directly use print(my_word[7:]) # prints 'orld'
my_word = 'hello world' print(my_word[-1]) # prints 'd' # - stands from last starting with index 1 print(my_word[-4:]) # prints 'orld' # if you know the length you can directly use print(my_word[7:]) # prints 'orld'